package com.hc.bankonline.services;

import java.util.Date;
import java.util.List;
import java.util.Map;

import com.hc.bankonline.dao.BankOnlineInsertDao;

public class BankOnlineRecordservicesImpl implements BankOnlineRecordservices {
	BankOnlineInsertDao bankOnlineInsertDao = new BankOnlineInsertDao();
	@Override
	public boolean insertRecordIn(double money,String cardno) {
		int i = bankOnlineInsertDao.insertRecordIn(money,cardno);
		if(i > 0){
			return true;
		}
		return false;
	}
	public boolean insertRecordOut(double money,String cardno) {
		int i = bankOnlineInsertDao.insertRecordOut(money,cardno);
		if(i > 0){
			return true;
		}
		return false;
	}
	@Override
	public List<Map<String, Object>> searchAll(Date beforetime, Date aftertime,
			String cardno, int indexPage, int pageSize) {
		return bankOnlineInsertDao.searchAll(beforetime, aftertime, cardno, indexPage, pageSize);
	}
	@Override
	public int findTotalTable(String cardno) {
		return bankOnlineInsertDao.findTotalTable(cardno);
	}
	@Override
	public int findTotalPage(String cardno, int indexPage, int pageSize) {
		int totalTable = bankOnlineInsertDao.findTotalTable(cardno);
		return totalTable % pageSize == 0? totalTable / pageSize : totalTable / pageSize+1;
	}


}
